import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import legacy from '@vitejs/plugin-legacy';
import copyPlugin from 'rollup-plugin-copy'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  build: {
    emptyOutDir: false, // 将此配置项设为false即可
    rollupOptions: {
      plugins: [
        copyPlugin({
          targets: [{ src: 'README.md', dest: 'dist/更新日志' }],
        }),
      ],
    },
    outDir: 'dist',
    assetsDir: 'assets',
  },
  plugins: [
    vue(),
    legacy({
			targets: ['ie>=11'],
			additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
		})
  ],
  resolve: {
    // Vite路径别名配置
    alias: {
      '@': path.resolve('./src')
    }
  }
})
